<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>添加用户</title>
<jsp:include page="../inc.jsp"></jsp:include>
<script type="text/javascript">
	$(function() {//加载下拉框
		$('#hh').hide();
		$('#ks').combobox({
			url : '${pageContext.request.contextPath}/officeAction!findAll.action',
			valueField : 'value',
			textField : 'text'
		});
	});
	function sub() {//提交方法
		$('#ff').form('submit', {
			url : '${pageContext.request.contextPath}/userAction!save.action',
			success : function(d) {
				var obj = jQuery.parseJSON(d);
				if (obj.success) {
					$('#ff').form('clear');
				} else {
					$('#ff').form('clear');
				}
				$.messager.show({
					title : '提示',
					msg : obj.msg
				});
			}
		});
	}
	function cc() {//清空表单
		$('#ff').form('clear');
	}
</script>
</head>
<!-- 布局 -->
<body class="easyui-layout">
	<div data-options="region:'center'" style="background:#eee;">
		<div class="easyui-panel" style="width:400px;">
			<div style="padding:10px 50px 20px 50px">
				<form id="ff" method="post"><!-- 表单 -->
					<table cellpadding="5">
						<tr>
							<td>用户名:</td>
							<td><input class="easyui-validatebox" type="text" name="userNicheng" data-options="required:true"></input></td>
						</tr>
						<tr>
							<td>密码:</td>
							<td><input class="easyui-validatebox" type="password" name="userPwd" data-options="required:true"></input></td>
						</tr>
						<tr>
							<td>重新输入密码:</td>
							<td><input class="easyui-validatebox" type="password" name="rePwd" data-options="required:true,validType:'eqPwd[\'#ff input[name=userPwd]\']'"></input></td>
						</tr>
						<tr>
							<td>用户真实姓名:</td>
							<td><input class="easyui-validatebox" type="text" name="userTruename" data-options="required:true,validType:'checkZhongw[]'"></input></td>
						</tr>
						<tr>
							<td>用户角色:</td>
							<td><input class="easyui-combobox" data-options="url:'${pageContext.request.contextPath}/role.json',onSelect: function(rec){  
														            if(rec.text=='医生'){
														            	$('#hh').show();
														            	$('#dd').attr('disabled',false);
														            	
														            }  else{														            
														            	$('#dd').val('');
														            	$('#hh').hide();
														            	$('#dd').attr('disabled',true);
														            }
														        }" " name="userRole" /></td>
						</tr>
						<tr id="hh">
							<td>科室:</td>
							<td><input id="ks" name="officeId" /></td>
						</tr>
						<tr>
							<td>挂号费:</td>
							<td><input id="dd" disabled="disabled" type="text" name="userPrice" /></td>
						</tr>
					</table>
				</form>
				<div style="text-align:center;padding:5px"><!-- 按钮 -->
					<a href="javascript:void(0)" class="easyui-linkbutton" onclick="sub()">新建</a> <a href="javascript:void(0)" class="easyui-linkbutton" onclick="cc()">清空</a>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
